<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

	<%-- CSS Style Declarations --%>
	<link rel ="stylesheet" type="text/css" href="stylesheets/style.css" ></link>
	
		<%-- Java imports --%>
	<%@ page import="java.io.*" %>
	<%@ page import="java.util.*" %>
	<%@ page import="flashcardtest.FlashCardSet" %>
	<%@ page import="flashcardtest.FlashCardHand" %>
	<%@ page import="flashcardtest.FlashCard" %>
	<%@ page import="flashcardtest.User" %>
	<%@ page import="flashcardtest.FlashCardCore" %>
	<%@ page import="com.google.appengine.api.users.UserService" %>
	<%@ page import="com.google.appengine.api.users.UserServiceFactory" %>
	
	<%-- Get reference to Java Objects --%>
	<%  FlashCardCore core = (FlashCardCore) request.getSession().getAttribute("core");
		if (core == null) {
			core = new FlashCardCore();
			request.getSession().setAttribute("core", core);
		}
		FlashCardHand localhand = (FlashCardHand) core.getFlashCardHand();
		%>
	<%-- Detect User Logged In --%>
	<%
		if (!core.loggedIn()){
			response.sendRedirect("/login.jsp");
		}
	  	%>

<title>Test</title>
</head>

<body>

<div id="center-wrapper">
<div id="center-column">

<!-- Header -->
<div id="header">
<FORM action="tomain" method="post">
			<input
				type="submit"
				name="button1"
				class="headerbutton"
				value="Main Menu"
				title="">
</FORM>
</div> <!-- header -->

<!-- User name -->
<div id="user_name">
	<% out.println( core.getUserName() + 
			" (<a href=\"" + core.getLogoutURL(request) +
			"\">sign out</a>)"); %>
</div> <!-- /user name -->

<!-- Dictionary Title -->
<div id="set_name">
	<% out.println(localhand.getTitle());%>
</div> <!-- dictionary title -->

<!-- Score in Header -->
<div style="
	position:absolute;
	top:35px;
	left:400px;
	color:#FFFFFF;
	font-weight:bold;
	">
	<font color="#620A00">Correct:</font> <% //out.println(request.getSession().getAttribute("correct")); %>
</div>
<div style="
	position:absolute;
	top:35px;
	left:490px;
	color:#FFFFFF;
	font-weight:bold;
	">
	<font color="#620A00">Incorrect:</font> <% //out.println(request.getSession().getAttribute("incorrect")); %>
</div><!-- score -->

<!-- Test Word -->
<div id="test-word">
	<% out.println(localhand.getTestKey()); %>
</div> <!-- test-word -->

<%-- Answer buttons --%>
<div style="
	position:absolute;
	width: 600px;
	top:155px;
	left:0px;
	text-align:center;
	">
<FORM action="test" method="post">
			<input
				type="submit"
				name="button1"
				class="cardbutton"
				value="<%out.println(localhand.getCardKey(0));%>"><br>
			<input
				type="submit"
				name="button1"
				class="cardbutton"
				value="<%out.println(localhand.getCardKey(1));%>"><br>
			<input
				type="submit"
				name="button1"
				class="cardbutton"
				value="<% out.println(localhand.getCardKey(2)); %>">
				
				
</FORM>
</div><!-- answer buttons -->

<!-- Result -->
<div style="
	position:absolute;
	top:390px;
	left:0px;
	width:600px;
	color:#A63F00;
	font-size:14px;
	font-weight:bold;
	text-align: center;
	">
	<% out.println( request.getSession().getAttribute("result")); %>
</div> <!-- Result -->

</div> <!-- center-column -->
</div> <!-- center-wrapper -->
</body>
</html>